import "./style/base.css";
import App from "./App.vue";
import Vue from "Vue";
// import Vuex from "vuex";
import store from "./utils/store";
import { URL_PREFIX } from "./utils/common";

import VueRouter from "vue-router";

// Vue.use(Vuex);
// const store = new Vuex.Store({
//   state: {
//     count: 0
//   },
//   mutations: {
//     incre(state) {
//       state.count += 1;
//     }
//   },
//   actions: {
//     incre({ commit, state }) {
//       console.log(commit);
//       console.log(state);
//       state.count++;
//     }
//   }
// });
Vue.use(VueRouter);

const routes = [
  {
    path: "/router/one",
    component: {
      render: h => h("div", "第一个路由页面")
    }
  },
  {
    path: "/router/two",
    component: {
      render: h => h("div", "第2个路由页面"),
      watch: {
        $route(to,from){
          console.log("to",to);
          console.log("from",from);
        }
      }
    }
  }
];

const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
});

new Vue({
  router,
  store,
  el: "#app",
  render: h => h(App)
});
console.log("url: ", URL_PREFIX);
